package com.heima.admin.controller;

import com.heima.admin.service.AdSensitiveService;
import com.heima.apis.admin.AdChannelControllerApi;
import com.heima.apis.admin.AdSensitiveControllerApi;
import com.heima.model.admin.dtos.AdSensitiveDto;
import com.heima.model.admin.pojos.AdChannel;
import com.heima.model.admin.pojos.AdSensitive;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/sensitive")
@Api(tags = "敏感词管理")

public class AdSensitiveController implements AdSensitiveControllerApi {
    @Autowired
     AdSensitiveService adSensitiveService;

    @PostMapping("/list")
    @Override
    public ResponseResult findByNameAndAge(@RequestBody AdSensitiveDto dto) {
        return adSensitiveService.findByNameAndAge(dto);
    }
    @PostMapping("/save")
    @Override
    public ResponseResult insert(@RequestBody AdSensitive adsensitive) {
        return adSensitiveService.insert(adsensitive);
    }

    @DeleteMapping ("/del/{id}")
    @Override
    public ResponseResult deleteById(@PathVariable("id") Integer id) {
        return adSensitiveService.deleteById(id);
    }
    @PostMapping("/update")
    @Override
    public ResponseResult update(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.update(adSensitive);
    }

}